package com.xiaomuwu.android.ui.detail

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.xiaomuwu.android.logic.Repository
import com.xiaomuwu.android.logic.model.ForResDetail

class ResDetailViewModel:ViewModel() {

    private val toResDetailLiveData=MutableLiveData<ForResDetail>()

    val resDetailLiveData=Transformations.switchMap(toResDetailLiveData){forResDetail->
        Repository.getResDetail(forResDetail)
    }

    fun getResDetailLiveData(forResDetail:ForResDetail){
        toResDetailLiveData.value=forResDetail
    }

}